﻿/*
 * Created by SharpDevelop.
 * User: lpelegrini
 * Date: 22/06/2013
 * Time: 18:47
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Data;

namespace Fazenda.Entity
{
	/// <summary>
	/// Description of Person.
	/// </summary>
	public class Person
	{
		public const int CPFSIZE = 11;
		public const int CNPJSIZE = 14;
		public int ID { get; set; }
		public string Name { get; set; }
		public int Category  { get; set; }
		public int PersonType  { get; set; }
		private string document;
		
		public string Document
		{
			get
			{
				return this.document;
			}
			set
			{
				if (this.PersonType.Equals(1))
				{
					if (value.Length != CPFSIZE)
					{
						throw new ArgumentException();
					}
					else
					{
						this.document = value;
					}
				}
				else
				{
					if (value.Length != CNPJSIZE)
					{
						throw new ArgumentException();
					}
					else
					{
						this.document = value;
					}
				}
			}
		}
	}
}